package org.firebug.metadata.client.feign;

import org.firebug.metadata.client.configuration.FeignClientConfiguration;
import org.firebug.metadata.client.hystrix.RegionHystrix;
import org.firebug.metadata.client.vo.RegionVO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

import static org.firebug.metadata.client.Constant.FEIGN_CLIENT_NAME;
import static org.firebug.metadata.client.Constant.FEIGN_CLIENT_PATH;

/**
 * 地区服务Feign
 */
@FeignClient(name = FEIGN_CLIENT_NAME, path = FEIGN_CLIENT_PATH + "/region", fallback = RegionHystrix.class, configuration = FeignClientConfiguration.class)
public interface RegionFeign {
    @RequestMapping(value = "/query/{code}", method = {RequestMethod.GET})
    RegionVO query(@PathVariable("code") String code);

    @RequestMapping(value = "/list/{code}", method = {RequestMethod.GET})
    List<RegionVO> list(@PathVariable("code") String code);

    @RequestMapping(value = "/list/{code}/{sector}", method = {RequestMethod.GET})
    List<RegionVO> list(@PathVariable("code") String code, @PathVariable(value = "sector") int sector);
}
